ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Newt_Male Class Reference

The newt male class. More...

#include <Newt.h>

Inheritance diagram for Newt_Male:
Newt_Adult Newt_Juvenile Newt_Base TAnimal TALMaSSObject

Public Member Functions

 Newt_Male (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib)
 Newt_Male constructor. More...
 
 ~Newt_Male ()
 Newt_Male destructor. More...
 
virtual void ReInit (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void BeginStep (void)
 Newt_Male BeingStep code. Called once per timestep, this only records pond presence. More...
 
virtual void Step (void)
 Newt_Male Step code. This is called continuously until all animals report that they are 'DONE'. More...
 
virtual TTypeOfNewtState st_Develop (void)
 Male development state. More...
 
void InternalPesticideHandlingAndResponse ()
 For handlng of class-specific pesticide effects. More...
 
- Public Member Functions inherited from Newt_Adult
 Newt_Adult (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib)
 Newt_Adult constructor. More...
 
 ~Newt_Adult ()
 Newt_Male destructor. More...
 
virtual void Init (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age)
 Initialise object. More...
 
int GetInPond ()
 Returns the current pond status (-1 if not in pond else the pond ref is returned) More...
 
void SetInPond ()
 Forces setting the in pond status to the first pond ref - used only on start-up. More...
 
- Public Member Functions inherited from Newt_Juvenile
 Newt_Juvenile (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib)
 Newt_Juvenile constructor. More...
 
 ~Newt_Juvenile ()
 Newt_Juvenile destructor. More...
 
double GetWeight ()
 Get method for m_weight. More...
 
void SetWeight (double a_weight)
 Set method for m_weight. More...
 
void InternalPesticideHandlingAndResponse ()
 For handlng of class-specific pesticide effects. More...
 
- Public Member Functions inherited from Newt_Base
 Newt_Base (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, bool a_reproinhib)
 Newt constructor. More...
 
void Init (vector< unsigned > a_pond, Newt_Population_Manager *a_NPM, bool a_reproinhib)
 Intitialise object. More...
 
void ReInit (int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, bool a_reproinhib)
 ReInit for object pool. More...
 
 ~Newt_Base ()
 Newt destructor. More...
 
virtual int WhatState ()
 Returns the state number for display purposes. More...
 
TTypeOfNewtState st_Develop (void)
 Behavioural state development - does nothing in the base class. More...
 
TTypeOfNewtState st_Movement (void)
 Behavioural state movement - does nothing in the base class. More...
 
void st_Dying (void)
 Behavioural state dying. More...
 
virtual void EndStep (void)
 The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
unsigned GetAge ()
 A typical interface function - this one returns the Age as an unsigned integer. More...
 
void SetAge (unsigned a_age)
 A typical interface function - this one sets the Age as an unsigned integer. More...
 
unsigned GetHomePond ()
 A typical interface function - this one returns the home pond reference as an unsigned integer. More...
 
void SetHomePond (unsigned a_pond)
 A typical interface function - this one sets the home pond reference as an unsigned integer. More...
 
void InternalPesticideHandlingAndResponse (double)
 For handlng of class-specific pesticide effects. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

virtual TTypeOfNewtState st_EvaluateHabitat (void)
 Adult evaluate habitat behaviour. More...
 
- Protected Member Functions inherited from Newt_Adult
void CalcMovementVector (void)
 Calculates the direction needed to move in to get to the target pond. More...
 
bool AgeMortTest (void)
 Ages the adult and applies a daily mortality probability. More...
 
virtual TTypeOfNewtState st_Disperse (void)
 Adult development state. More...
 
virtual TTypeOfNewtState st_Overwinter (void)
 Adult dormant state. More...
 
virtual TTypeOfNewtState st_Migrate (void)
 Adult migration to pond state. More...
 
- Protected Member Functions inherited from Newt_Juvenile
virtual TTypeOfNewtState st_NextStage (void)
 Juvenile maturation. More...
 
void MoveTo (TTypeDirectedWalk a_directedness, int a_stepsize, int a_steps)
 Top level control of newt movement. More...
 
void NewtDoWalking (int &a_vector, int a_stepsize, int a_steps, int &vx, int &vy)
 This method moves the newt through the landscape. More...
 
void NewtDoWalkingCorrect (int &a_vector, int a_stepsize, int a_steps, int &vx, int &vy)
 This method moves the newt through the landscape using wrap around corrects. More...
 
int NewtMoveQuality (int a_x, int a_y, TTypesOfLandscapeElement &a_tole)
 Tests the habitat quality for a square to move to. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Newt_Adult
static double m_AdultPPPThreshold = cfg_NewtAdultPPPToxTrigger.value()
 The threshold for effect of PPP on adults. More...
 
static double m_AdultPPPElimRate = cfg_NewtAdultPPPToxEliminationRate.value()
 The daily proportion of PPP body burden that is not eliminated for adults. More...
 
static double m_AdultPPPEffectProbability = cfg_NewtAdultPPPEffectProbability.value()
 The daily probability of effect if above m_AdultPPPThreshold for adults. More...
 
static unsigned m_AdultLifespan = cfg_NewtAdultLifespan.value()
 
static int m_newtadultwalkspeed = cfg_NewtWalkSpeed.value()/10
 The max walking speed of a newt. More...
 
- Static Public Attributes inherited from Newt_Juvenile
static double m_JuvenilePPPThreshold_Min = 0
 The minimum threshold for effect of PPP on juveniles. More...
 
static double m_JuvenilePPPThreshold_EnvConc = cfg_NewtJuvenilePPPToxTrigger_EnvConc.value()
 The environmental concentration threshold for effect of PPP on juveniles. More...
 
static double m_JuvenilePPPThreshold_Overspray = cfg_NewtJuvenilePPPToxTrigger_Overspray.value()
 The overspray threshold for effect of PPP on juveniles. More...
 
static double m_JuvenilePPPElimRate = cfg_NewtJuvenilePPPToxEliminationRate.value()
 The daily proportion of PPP body burden that is not eliminated for juveniles. More...
 
static double m_JuvenilePPPEffectProbability_EnvConc = cfg_NewtJuvenilePPPEffectProbability_EnvConc.value()
 The daily probability of effect if above m_JuvenilePPPThreshold for juveniles for environmental concentration. More...
 
static double m_JuvenilePPPEffectProbability_Overspray = cfg_NewtJuvenilePPPEffectProbability_Overspray.value()
 The daily probability of effect if above m_JuvenilePPPThreshold for juveniles for overspray. More...
 
static double m_JuvenileDailyWeightGain = cfg_NewtJuvenileDailyLengthGain.value()
 Used in determining daily growth. More...
 
static int m_SimW = 0
 The width of the simulation map, stored for fast access. More...
 
static int m_SimH = 0
 The height of the simulation map, stored for fast access. More...
 
static double m_roadmortalityprob = cfg_NewtRoadMortalityProb.value()
 The probability of death when crossing a road. More...
 
static int m_newtwalkspeed = cfg_NewtWalkSpeed.value()
 The max walking speed of a newt. More...
 
static int m_newtwalkstepsize = cfg_NewtWalkStepsize.value()
 The size of a step when evaluating habitat during walking. More...
 
static double m_goodhabitatdispersalprob = cfg_newtgoodhabitatdispersalprob.value()
 Probability of dispersal in good habitat. More...
 
static double m_poorhabitatdispersalprob = cfg_newtpoorhabitatdispersalprob.value()
 Probability of dispersal in poor habitat. More...
 
static double m_NewtDormancyTemperature = cfg_newtdormancytemp.value()
 Temperature in degrees that the newts become dormant. More...
 
static double m_NewtDormancyHumidity = cfg_newtdormancyhumidity.value()
 Temperature in degrees that the newts become dormant. More...
 
- Static Public Attributes inherited from Newt_Base
static double m_EggDevelopmentDDTotal = cfg_NewtEggDevelTotal.value()
 
static double m_EggDevelopmentDDParameter = cfg_NewtEggDevelDDParameter.value()
 
static double m_JuvenileDevelopmentSize = cfg_NewtJuvenileDevelSize.value()
 
static double m_EggMortalityChance = cfg_NewtEggMortalityChance.value()
 
static double m_JuvenileMortalityChance = 0.0
 
static double m_AdultMortalityChance = 0.0
 
static bool m_test_pesticide_egg = cfg_Newt_Test_Pesticide_Egg.value()
 Flags to record whether we are in pesticide testing mode. More...
 
static bool m_test_pesticide_larva = cfg_Newt_Test_Pesticide_Larva.value()
 
static bool m_test_pesticide_terrestrial = cfg_Newt_Test_Pesticide_Terrestrial.value()
 
- Protected Attributes inherited from Newt_Adult
int m_targetpondx
 x-coord of a target pond More...
 
int m_targetpondy
 y-coord of a target pond More...
 
- Protected Attributes inherited from Newt_Juvenile
int m_InPond
 The polyrefindex for the pond the newt is in, or -1 if not in a pond. More...
 
double m_weight
 
unsigned m_OurVector
 The last direction we moved in. More...
 
TTypesOfLandscapeElement m_CurrentHabitat
 The current habitat type the newt is in. More...
 
bool m_forcedisperse
 A flag to force dispersal from the breeding ponds. More...
 
- Protected Attributes inherited from Newt_Base
TTypeOfNewtState m_CurrentNewtState
 Variable to record current behavioural state. More...
 
unsigned m_Age
 
vector< unsigned > m_pondlist
 
Newt_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
double m_body_burden
 The current PPP body burden for use in pesticide testing mode. More...
 
bool m_reproductiveinhibition
 A flag to indicate environmentally induced reproductive inhibition (value is inherited by descendent classes) More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Detailed Description

The newt male class.

Constructor & Destructor Documentation

◆ Newt_Male()

Newt_Male::Newt_Male ( int  a_x,
int  a_y,
vector< unsigned >  a_pond,
Landscape a_L,
Newt_Population_Manager a_NPM,
unsigned  a_age,
bool  a_reproinhib 
)

Newt_Male constructor.

Newt_Male adds no new attributes to Newt_Adult.
The only special behaviour defined here is the Step code.

891  : Newt_Adult(a_x, a_y, a_pond, a_L, a_NPM, a_age, a_reproinhib) {
892  ;
893 }
Newt_Adult(int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib)
Newt_Adult constructor.
Definition: Newt.cpp:689

◆ ~Newt_Male()

Newt_Male::~Newt_Male ( void  )

Newt_Male destructor.

896  {
897  ;
898 }

Member Function Documentation

◆ BeginStep()

void Newt_Male::BeginStep ( void  )
virtual

Newt_Male BeingStep code. Called once per timestep, this only records pond presence.

This is a speed improvement. The newt records that there is a male in the pond to prevent the long search time if a female is looking. This is done by true/false because currently there is no need to identify a particular male. This must be done in the begin step to prevent problems with the timing for females, and resetting by DoDevelopment for pond flags.

Reimplemented from Newt_Base.

906  {
913 }
void SetMaleNewtPresent(int a_InPondIndex)
Sets a male as being present in a pond.
Definition: landscape.h:349
int m_InPond
The polyrefindex for the pond the newt is in, or -1 if not in a pond.
Definition: Newt.h:363
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References Newt_Juvenile::m_InPond, TAnimal::m_OurLandscape, and Landscape::SetMaleNewtPresent().

◆ InternalPesticideHandlingAndResponse()

void Newt_Male::InternalPesticideHandlingAndResponse ( )

For handlng of class-specific pesticide effects.

This method is re-implemented from Newt_Base for any class which has pesticide response behaviour. If the body burden exceeds the trigger then an effect is tested for and implemented depending on the pesticide type.

1280  {
1285  // Test against the threshold level for Adult to determine if an effect needs to be tested for
1287  // We are above the PPP body burden threshold, so make a test for effect
1290  switch (tp) {
1291  case ttop_NoPesticide:
1292  break;
1293  case ttop_ReproductiveEffects: // Reproductive effects
1294  // TODO
1295  break;
1296  case ttop_AcuteEffects: // Acute mortality
1298  KillThis();
1299  break;
1300  case ttop_MultipleEffects:
1301  break;
1302  default:
1303  g_msg->Warn("Unknown pesticide type used in Newt_Female::InternalPesticideHandlingAndResponse() pesticide code ", int(tp));
1304  exit(47);
1305  }
1306  }
1307  }
1308 }
MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
@ toNewts_Die
Definition: Newt.h:75
TTypesOfPesticide SupplyPesticideType(void)
Definition: landscape.h:433
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
static double m_AdultPPPThreshold
The threshold for effect of PPP on adults.
Definition: Newt.h:411
static double m_AdultPPPEffectProbability
The daily probability of effect if above m_AdultPPPThreshold for adults.
Definition: Newt.h:415
TTypeOfNewtState m_CurrentNewtState
Variable to record current behavioural state.
Definition: Newt.h:113
double m_body_burden
The current PPP body burden for use in pesticide testing mode.
Definition: Newt.h:121
virtual void KillThis()
Definition: PopulationManager.h:219
TTypesOfPesticide
Definition: landscape.h:66
@ ttop_NoPesticide
Definition: landscape.h:67
@ ttop_AcuteEffects
Definition: landscape.h:68
@ ttop_MultipleEffects
Definition: landscape.h:74
@ ttop_ReproductiveEffects
Definition: landscape.h:69

References g_msg, g_rand_uni, TAnimal::KillThis(), Newt_Adult::m_AdultPPPEffectProbability, Newt_Adult::m_AdultPPPThreshold, Newt_Base::m_body_burden, Newt_Base::m_CurrentNewtState, TAnimal::m_OurLandscape, Landscape::SupplyPesticideType(), toNewts_Die, ttop_AcuteEffects, ttop_MultipleEffects, ttop_NoPesticide, ttop_ReproductiveEffects, and MapErrorMsg::Warn().

Referenced by st_Develop().

◆ ReInit()

void Newt_Male::ReInit ( int  a_x,
int  a_y,
vector< unsigned >  a_pond,
Landscape a_L,
Newt_Population_Manager a_NPM,
unsigned  a_age,
bool  a_reproinhib 
)
virtual

Used to re-use an object - must be implemented in descendent classes.

Reimplemented from Newt_Adult.

901  {
902  Newt_Adult::ReInit(a_x, a_y, a_pond, a_L, a_NPM, a_age, a_reproinhib);
903 }
virtual void ReInit(int a_x, int a_y, vector< unsigned > a_pond, Landscape *a_L, Newt_Population_Manager *a_NPM, unsigned a_age, bool a_reproinhib)
Used to re-use an object - must be implemented in descendent classes.
Definition: Newt.cpp:701

References Newt_Adult::ReInit().

Referenced by Newt_Population_Manager::CreateObjects().

◆ st_Develop()

TTypeOfNewtState Newt_Male::st_Develop ( void  )
virtual

Male development state.

Adds pesticide handling to the Adult version of st_Develop If there is the need to test for pesticide effects then the body-burden is adjusted for yesterdays elimination, then pesticide at this location is determined and any intake stored. InternalPesticideHandlingAndResponse is called, and if the body-burden is greater than the threshold for effects then the impacts are determined.

Reimplemented from Newt_Adult.

956  {
963  // Eliminate some/all of yesterdays body burden of PPP by multiplying by 1-the daily elimination rate
965  // Pick up the pesticide to add to the body burden
969  }
970  return Newt_Adult::st_Develop();
971 }
double SupplyPesticide(int a_x, int a_y, PlantProtectionProducts a_ppp)
Gets total pesticide for a location.
Definition: Landscape.cpp:586
static double m_AdultPPPElimRate
The daily proportion of PPP body burden that is not eliminated for adults.
Definition: Newt.h:413
virtual TTypeOfNewtState st_Develop(void)
Adult development state.
Definition: Newt.cpp:751
static bool m_test_pesticide_terrestrial
Definition: Newt.h:108
void InternalPesticideHandlingAndResponse()
For handlng of class-specific pesticide effects.
Definition: Newt.cpp:1280
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
@ ppp_1
Definition: farm.h:422

References InternalPesticideHandlingAndResponse(), Newt_Adult::m_AdultPPPElimRate, Newt_Base::m_body_burden, Newt_Base::m_CurrentNewtState, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Newt_Base::m_test_pesticide_terrestrial, ppp_1, Newt_Adult::st_Develop(), Landscape::SupplyPesticide(), and toNewts_Die.

Referenced by Step().

◆ st_EvaluateHabitat()

TTypeOfNewtState Newt_Male::st_EvaluateHabitat ( void  )
protectedvirtual

Adult evaluate habitat behaviour.

Reimplemented from Newt_Adult.

974  {
976 }
virtual TTypeOfNewtState st_EvaluateHabitat(void)
Adult evaluate habitat behaviour.
Definition: Newt.cpp:780

References Newt_Adult::st_EvaluateHabitat().

Referenced by Step().

◆ Step()

void Newt_Male::Step ( void  )
virtual

Newt_Male Step code. This is called continuously until all animals report that they are 'DONE'.

Reimplemented from Newt_Juvenile.

916  {
917  if (m_StepDone || m_CurrentStateNo == -1) return;
918  switch (m_CurrentNewtState) {
919  case toNewts_InitialState: // Initial state always starts with develop
921  break;
922  case toNewts_Develop:
923  case toNewts_Breed:
924  m_CurrentNewtState = st_Develop(); // Will return toNewts_Die, toNewts_Overwinter, toNewts_EvaluateLocation
925  break;
926  case toNewts_Dispersal:
927  m_CurrentNewtState = st_Disperse(); // Will return toNewts_Develop or toNewts_Die
928  break;
929  case toNewts_Migrate:
930  m_CurrentNewtState = st_Migrate(); // Will return toNewts_Develop, toNewts_Die, or toNewts_Breed which equates to develop in males
931  m_StepDone = true;
932  break;
934  m_CurrentNewtState = st_EvaluateHabitat(); // will return toNewts_Migrate, toNewts_Develop, toNewts_Dispersal
935  m_StepDone = true;
936  break;
937  case toNewts_Overwinter:
938  m_CurrentNewtState = st_Overwinter(); // will return toNewts_Migrate, toNewts_Develop, toNewts_Dispersal
939  m_StepDone = true;
940  break;
941  case toNewts_Die:
942  st_Dying(); // No return
943  m_StepDone = true;
944  break;
945  case toNewts_Remove:
946  m_CurrentStateNo = -1;
947  m_StepDone = true;
948  break;
949  default:
950  m_OurLandscape->Warn( "Newt_Male::Step()", " unknown state" );
951  exit( 1 );
952  }
953 }
@ toNewts_Dispersal
Definition: Newt.h:71
@ toNewts_Migrate
Definition: Newt.h:72
@ toNewts_EvaluateLocation
Definition: Newt.h:68
@ toNewts_Develop
Definition: Newt.h:67
@ toNewts_Remove
Definition: Newt.h:70
@ toNewts_Breed
Definition: Newt.h:73
@ toNewts_Overwinter
Definition: Newt.h:74
@ toNewts_InitialState
Definition: Newt.h:66
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
virtual TTypeOfNewtState st_Disperse(void)
Adult development state.
Definition: Newt.cpp:726
virtual TTypeOfNewtState st_Migrate(void)
Adult migration to pond state.
Definition: Newt.cpp:820
virtual TTypeOfNewtState st_Overwinter(void)
Adult dormant state.
Definition: Newt.cpp:811
void st_Dying(void)
Behavioural state dying.
Definition: Newt.cpp:87
virtual TTypeOfNewtState st_EvaluateHabitat(void)
Adult evaluate habitat behaviour.
Definition: Newt.cpp:974
virtual TTypeOfNewtState st_Develop(void)
Male development state.
Definition: Newt.cpp:956
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116

References Newt_Base::m_CurrentNewtState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_Develop(), Newt_Adult::st_Disperse(), Newt_Base::st_Dying(), st_EvaluateHabitat(), Newt_Adult::st_Migrate(), Newt_Adult::st_Overwinter(), toNewts_Breed, toNewts_Develop, toNewts_Die, toNewts_Dispersal, toNewts_EvaluateLocation, toNewts_InitialState, toNewts_Migrate, toNewts_Overwinter, toNewts_Remove, and Landscape::Warn().


The documentation for this class was generated from the following files: